home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_08
/
1108114a
< prev
next >
Wrap
Text File
|
1993-06-07
|
334b
|
25 lines
/* swap2.c: A working swap function */
#include <stdio.h>
void swap(int *, int *);
main()
{
int i = 7, j = 8;
swap(&i,&j);
printf("i == %d, j == %d\n",i,j);
return 0;
}
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
/* OUTPUT:
* i == 8, j == 7 */